package com.xand.bt;

import java.util.List;

import com.xand.bt.api.MarketConnector;
import com.xand.bt.api.MarketImageChangeNotify;
import com.xand.mtgox.connector.MtGoxConnector;

public class BitcoinMarketController {

	private static BitcoinMarketController instance;
	
	private MarketConnector mtGoxConnector;
	private MarketStoreUpdateThread mtGoxConnectorThread;
	
	public static BitcoinMarketController getInstance() {
		
		if(instance == null)
			instance = new BitcoinMarketController();
		
		return instance;
	}
	
	private BitcoinMarketController() {
		
		this.mtGoxConnector = new MtGoxConnector();
		this.mtGoxConnectorThread = new MarketStoreUpdateThread(MtGoxConnector.MARKET_LABEL, this.mtGoxConnector);
		
	}
	
	public void startMarketDepthThreads() {
		
		this.mtGoxConnectorThread.start();
		
	}
	
	public List<MarketImageChangeNotify> getMarketImageChanges() {
		
		List<MarketImageChangeNotify> ret = this.mtGoxConnector.getMarketImageChanges();
		
		return ret;
	}
	
	public static void main(String[] args) {
		
		BitcoinMarketController controller = BitcoinMarketController.getInstance();
		controller.startMarketDepthThreads();
		
	}
}
